package com.thon.service.user.impl;

import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.thon.dao.user.CharitarianDao;
import com.thon.dao.util.Page;
import com.thon.entity.user.Charitarian;
import com.thon.service.user.CharitarianService;

/**
* @File: CharitarianServiceImpl.java
* @author zemo 
* @mail chenzeming@lanbaoo.com
* @date: Feb 15, 2014 12:11:47 AM
* @Description: TODO
 */
@Service
@Transactional
public class CharitarianServiceImpl implements CharitarianService {

	@Autowired
	private CharitarianDao charitarianDao;
	
	@Override
	public void addCharitarian(Charitarian charitarian) {
		
		charitarianDao.save(charitarian);
	}

	@Override
	public Charitarian getCharitarian(Integer id) {
		
		return charitarianDao.get(id);
	}

	@Override
	public Page<Charitarian> findCharitarian(Byte status, int pageSize,int pageNo) {
		
		Page<Charitarian> page = new Page<Charitarian>();
		page.setPageNo(pageNo);
		page.setPageSize(pageSize);
		
		return charitarianDao.findCharitarian(page, status);
	}

	@Override
	public void updateCharitarian(Charitarian charitarian) {

		charitarianDao.update(charitarian);
	}
	
	@Override
	public Charitarian findCharitarianByUserId(int userId) {
		return charitarianDao.getCharitarianByUser(userId);
	}

}
